<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户登录</title>
    <style>
        body {
            background-image: url('p1.png');
            background-size: cover;
            background-position: center;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            color: #333;
            text-align: center;
        }

        button {
            background-color: rgba(255, 103, 0, 0.7); /* 降低透明度 */
            color: #fff;
            font-size: 14px;
            border: none;
            border-radius: 4px;
            padding: 10px 20px;
            margin: 10px;
            cursor: pointer;
            transition: all .2s ease-in-out;
        }

        button:hover {
            background-color: rgba(255, 103, 0, 0.9); /* 增加透明度 */
        }

        form {
            margin: 0 auto;
            max-width: 400px;
            background-color: rgba(0, 0, 0, 0.3); /* 降低透明度 */
            border-radius: 6px;
            padding: 24px;
            box-shadow: 0px 0px 16px rgba(0, 0, 0, 0.1);
            transform: translateY(50%);
        }

        form input, #msg {
            border: 1px solid #bfbfbf;
            padding: 10px;
            border-radius: 4px;
            width: 100%;
            margin: 10px 0;
            color: #333;
            box-sizing: border-box;
        }
        form input, #msg {
            border: 1px solid transparent;
            padding: 10px;
            border-radius: 4px;
            width: 100%;
            margin: 10px 0;
            color: #333;
            box-sizing: border-box;
        }

        #msg {
            font-size: 16px;
            color: red;
        }

        input:focus, #msg:focus {
            border-color: #ff6700;
            box-shadow: 0px 0px 8px rgba(255, 103, 0, 0.5);
        }

        a {
            color: white;
            text-decoration: none;
            transition: color 0.3s ease;
        }

        @keyframes glow {
            0% {
                background-color: rgba(255, 103, 0, 0.7);
            }
            50% {
                background-color: rgba(255, 103, 0, 0.9);
            }
            100% {
                background-color: rgba(255, 103, 0, 0.7);
            }
        }

        button {
            animation: glow 1s infinite alternate; /* 添加动画 */
        }
    </style>
</head>
<body>
<div>
    <form action="login" method="post" id="loginForm">
        <h1>用户登录</h1>
        账号：<input type="text" name="uname" id="uname" value="${messageModel.object.userName}"><br>
        密码：<input type="password" name="upwd" id="upwd" value="${messageModel.object.userPwd}"><br>
        <span id="msg">${messageModel.msg}</span><br>
        <button type="button" id="loginBtn">登录</button>
        <button type="button" id="registerBtn"><a href="registerde.jsp" >注册</a></button>
    </form>
</div>
</body>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">

    $("#loginBtn").click(function (){
        var uname = $("#uname").val();
        var upwd = $("#upwd").val();
        if (isEmpty(uname)) {
            $("#msg").html("用户账号不可为空！");
            return ;
        }
        if (isEmpty(upwd)){
            $("#msg").html("用户密码不可为空！");
            return ;
        }
        $("#loginForm").submit();
    });

    function isEmpty(str){
        if(str == null || str.trim() == ""){
            return true;
        }
        return false;
    }

</script>
</html>
